package com.polymorphic.demo02;

public class Test01 {
    public  static  void  uesrAnimal(Animal a){
        a.eat();
        //Dog dog =(Dog)a;//把动物变成狗看家
        if( a instanceof  Dog){
            Dog dog =(Dog)a;
            dog.watchHome();
        }

    }

    public static void main(String[] args) {
        uesrAnimal(new Dog());
        uesrAnimal(new Cat());
    }
}
